/*
 * @Description: 公告类型
 * @Author: Zzt
 * @Date: 2023-02-28 09:23:31
 * @LastEditTime: 2023-02-28 16:32:15
 */
import { configRequest } from '@/utils/request';
import { IPageQuery } from '@/interfaces/global';

export interface IChannelParams {
  code?: string;
  id?: number;
  name?: string;
  remark?: string;
  unitId?: number;
}

// 保存公告类型
export function saveChannel(data: IChannelParams) {
  return configRequest({
    url: `/notice-type`,
    method: 'post',
    data
  });
}
// 修改公告类型
export function editChannel(data: IChannelParams) {
  return configRequest({
    url: `/notice-type`,
    method: 'put',
    data
  });
}
// 查询全部公告类型
export function fetchChannelList(data: IChannelParams) {
  return configRequest({
    url: `/notice-type/list`,
    method: 'post',
    data
  });
}
// 分页查询公告类型
export function fetchChannelListByPage(data: IPageQuery<IChannelParams>) {
  return configRequest({
    url: `/notice-type/page`,
    method: 'get',
    data
  });
}

// 根据ID查询公告类型信息
export function fetchChannelById(id: string | number) {
  return configRequest({
    url: `/notice-type/${id}`,
    method: 'get'
  });
}
// 删除公告类型
export function delectChannelById(id: string | number) {
  return configRequest({
    url: `/notice-type/${id}`,
    method: 'delete'
  });
}
